import cv2
import numpy as np
img_path = '/data/lzy/tile_round2_train_20210204/all_train/198_19_t20201119103227654_CAM3_2.jpg'
image = cv2.imread(img_path)
img_encode = cv2.imencode('.jpg', image)[1]
data_encode = np.array(img_encode)
str_encode = data_encode.tostring()
nparray = np.fromstring(str_encode, np.uint8)
img_decoder = cv2.imdecode(nparray, cv2.IMREAD_COLOR)
cv2.imshow('decode', img_decoder)
cv2.waitKey(10000000)